<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--------------------------------------------------------------------------->  
<!--                           INTRODUCTION                                

 The Code Project article submission template (HTML version)

Using this template will help us post your article sooner. To use, just 
follow the 3 easy steps below:
 
     1. Fill in the article description details
     2. Add links to your images and downloads
     3. Include the main article text

That's all there is to it! All formatting will be done by our submission
scripts and style sheets. 

-->  
<!--------------------------------------------------------------------------->  
<!--                        IGNORE THIS SECTION                            -->
<html>
<head>
<title>The Code Project</title>
<Style>
BODY, P, TD { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt }
H2,H3,H4,H5 { color: #ff9900; font-weight: bold; }
H2 { font-size: 13pt; }
H3 { font-size: 12pt; }
H4 { font-size: 10pt; color: black; }
PRE { BACKGROUND-COLOR: #FBEDBB; FONT-FAMILY: "Courier New", Courier, mono; WHITE-SPACE: pre; }
CODE { COLOR: #990000; FONT-FAMILY: "Courier New", Courier, mono; }
</style>
<link rel="stylesheet" type="text/css" href="http://www.codeproject.com/App_Themes/NetCommunity/CodeProject.css">
</head>
<body bgcolor="#FFFFFF" color=#000000>
<!--------------------------------------------------------------------------->  


<!-------------------------------     STEP 1      --------------------------->
<!--  Fill in the details (CodeProject will reformat this section for you) -->

<pre>
Title:       Omniture Studio First Look
Author:      Chris Davis
Email:       chrisd@gravitybox.com
Member ID:   220760
Language:    C# 3.5
Platform:    Windows, .NET 3.5
Technology:  ASP.NET, C#, Omniture, Web Analytics
Level:       Intermediate, Advanced
Description: Add Omniture web analytics to your ASP.NET site
Section      Platforms, Frameworks & Libraries
SubSection   .NET Framework
License:     Ms-PL
</pre>

<!-------------------------------     STEP 2      --------------------------->
<!--  Include download and sample image information.                       --> 

<ul class=download>
<li><a href="http://omniture.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=32909#DownloadId=83195">Omniture Studio Installer - 1Mb </a></li>
<li><a href="GettingStarted.zip">This document - 100Kb </a></li>
</ul>


<!-------------------------------     STEP 3      --------------------------->

<!--  Add the article text. Please use simple formatting (<h2>, <p> etc)   --> 

<h2>Omniture Studio</h2>

<p>
Omniture Studio can be used to create a custom library for .NET developers to use when implementing Omniture. This greatly reduces development time and provides more structured and easy to understand code. It can be used to generate a library that is unique to your implementation and mask the built-in Omniture nomenclature.
</p>

<h2>Define a Project</h2>
<p>
You can use Omniture Studio to implement your Omniture solution once you have defined a structure. Omniture recommends that you build a Solution Design Document (SDD) that defines your metric structure. This includes your props, evars, and events. From this document, you can create a custom library for you specific site.
</p>

<p><img src="vs_sample_project.jpg" alt="VS.NET Sample Project" /></p>

<p>
First create a project and setup the project level properties. Define a project name, library folder, scode file path, etc. These will be used in the generation to customize you library.
</p>

<p><img src="evarscreen.jpg" alt="EVar Screen" /></p>

<p>
Next you begin to setup your evars, props, and events. The next three screens are very similar, one for each type. You can define these objects and give each an alias. When your library is generated it will use the alias as the object name. This allows you to have strongly-named objects instead of using the default names like evar1, evar2, etc. All objects types support aliases.
</p>

<p>
You can enter each item separately of course or use the paste button to paste multiple items at once in a tab delimited format. 
</p>
<p>
Finally you can define your site pages. Use the import feature to import all files from a C# web project or a .NET website. You do not need to define any pages; however doing so allow you to setup the Omniture page names and channels at design time. These will be compiled into an XML file used by the library to define static information like that as well as static evars, props, and events.
</p>

<p><img src="pagescreen.jpg" alt="Pages Screen" /></p>

<p>
Notice that each page has its own set of evars, props, and events. Any items associated with a page in the designer will be the default at runtime. You can of course define any of these at runtime, but if you have objects that should always appear on a page it is better to define them in the designer.
</p>
<p>
The defined pages are used in conjunction with the global setting &quot;Allow error on page not found&quot;. When this property is checked, pages not defined in your project will raise an exception at runtime. You can uncheck this property to allow any page name. Pages not defined in this scenario have no page or channel name at runtime.
</p>

<h2>Build and Use Library</h2>
<p>
Once you define your project, press the build button to create a custom library. This action takes the project settings and definitions and generates a .NET library based on it. Include this library in your web project and add a few line of code to your page.
</p>

<p><img src="page_snippet.jpg" alt="Page Snippet" /></p>

<p>
The following code creates the web control and sites it on the page. The page Render method is overridden rename forms that you have defined in your project. This is required for some Omniture plug-ins. If you do not need to override form names then this step if not necessary. If you define this on a base page it is a nice convenience to add a property for the web control. This allows user to address it as an object on every page as in the following code.
</p>

<p><img src="button_snippet.jpg" alt="Button Snippet" /></p>

<p>
To use the control simply call its properties in code. The following example sets the recruiter email and company props and calls the email employer event. Notice that the evars, props, and events are strongly-named.
</p>
<p>
You must add a line to the &quot;web.config&quot; file of your application as well. This informs the custom generated DLL of where your XML configuration file is located. In the AppSettings section, add a node with the key &quot;OmnitureSiteConfiguration&quot; and the absolute path to the generated XML file for the specified Omniture Studio project.
</p>

<pre lang="aspnet">
&lt;add key="OmnitureSiteConfiguration" value="MyProject.xml"/&gt;
</pre>

<h2>Performance</h2>
<p>
When the page is rendered to the clients, all necessary Omniture code is generated into it. This also works across pages. For example, if you capture the click event of a button and set some variables then redirect to another page, the Omniture code will be displayed on the next page. In fact, it will be displayed on what ever page is rendered to the client next. After a page is rendered to the client browser, all settings are reset. This ensures that the settings are never rendered twice and thus double counted. This functionality is also nice in that code can redirect a page an indefinite number of times without loosing your metrics. Always the final client render contains your tracking settings.
</p>

<h2>Summary</h2>
<p>
This tool allows you to create Omniture implementations very quickly. The amount of time to define your pages, evars, props, and events is severely restrained. You no longer need to write configuration files either. The tool generates a configuration file along with a custom .NET assembly that reads the configuration. If you make any changes to your implementation, there is no need to modify text files or any other file manually. You simple make the necessary changes in your model and regenerate. This is truly model devein development for Omniture.
</p>

<p>
<strong>Note:</strong>
Follow the project on <a target="_blank" href="http://omniture.codeplex.com">Codeplex</a>
</p>


<!-------------------------------    That's it!   --------------------------->
</body>

</html>
